package com.zerui.manager.icc.conf;

import com.dahuatech.icc.oauth.model.v202010.OauthConfigBaseInfo;
import com.dahuatech.icc.oauth.model.v202010.OauthConfigClientInfo;
import com.zerui.manager.icc.properties.ICCProperties;

import javax.annotation.Resource;

public class ICCOAuthConfigHolder {

    @Resource
    private ICCProperties iccProperties;

    public OauthConfigBaseInfo getOauthConfigClientInfo() {
        boolean enableHttps = iccProperties.getProtocol().equalsIgnoreCase("http");
        return new OauthConfigClientInfo(
                iccProperties.getHost(),
                iccProperties.getClientId(),
                iccProperties.getClientSecret(),
                enableHttps,
                String.valueOf(iccProperties.getPort()),
                String.valueOf(iccProperties.getPort())
        );
    }
}
